using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace MvcApplication4.Models.Mapping
{
    public class tb_UBSMap : EntityTypeConfiguration<tb_UBS>
    {
        public tb_UBSMap()
        {
            // Primary Key
            this.HasKey(t => t.ID_UBS);

            // Properties
            this.Property(t => t.Nome_UBS)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.Endereco)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.Bairro)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Cidade)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Estado)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Telefone)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Email)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("tb_UBS");
            this.Property(t => t.ID_UBS).HasColumnName("ID_UBS");
            this.Property(t => t.Nome_UBS).HasColumnName("Nome_UBS");
            this.Property(t => t.Endereco).HasColumnName("Endereco");
            this.Property(t => t.Bairro).HasColumnName("Bairro");
            this.Property(t => t.Cidade).HasColumnName("Cidade");
            this.Property(t => t.Estado).HasColumnName("Estado");
            this.Property(t => t.Telefone).HasColumnName("Telefone");
            this.Property(t => t.Email).HasColumnName("Email");
        }
    }
}
